#include <stdio.h>
#include <Windows.h>

int main()
{
	DWORD start = GetTickCount();
	freopen("test.in", "r", stdin);
	freopen("test.out", "w", stdout);
	int head = 0, foot = 0;
	int chicken = 0;
	int rabbit = 0;
	scanf("%d %d", &head, &foot);
	int ret = 0;
	for (  chicken = 0; chicken <= head; chicken++ ) {
		rabbit = head - chicken;
		if (  (chicken * 2 + rabbit * 4) == foot ) {
			ret = 1;
			printf("%d %d\n", chicken, rabbit);
		}
	}
	if ( ret == 0 ) {
		printf("-1 -1\n", chicken, rabbit);
	}
	DWORD time = GetTickCount() - start;
	printf("\ntime = %.2f\n", (1000.0 * time) / 905 );
	fclose(stdin);
	fclose(stdout);
	return 0;
}
